/**
 * AGridResponse.java
 *
 * Copyright (C) 2009,  Tomislav Milkovic
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package extjsdyntran.extjs.grid;

import java.util.Collection;
import java.util.Vector;

/**
 * @description Support class for ExtJs grid response
 */
public abstract class AGridResponse {
	
	protected String msg;
	protected boolean success;
	protected int total = 0;
	protected Collection<Object> data;
		
	public AGridResponse() {
		super();
		data = new Vector<Object>();
		reset();
	}
	
	public void reset(){
		data.clear();
		success = false;
		msg="";
		total=0;
	}
	
	
	public int getTotal() {
		return total;
	}

	public void setTotal() {
		this.total = data.size();
	}

	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public boolean isSuccess() {
		return success;
	}
	public void setSuccess(boolean success) {
		this.success = success;
	}
	public Collection<Object> getData() {
		return data;
	}
	public void addRecord(Object rec) {
		 data.add(rec);
	}
	
}
